import baseRequest from '../utils/requset'

// 获取地址列表
export function getUserAddressApi (data) {
    return baseRequest.baseRequest('api/userAddress/queryByUid', 'get', data)
}
// 新增地址 /api/userAddress/add post
export function addUserAddressApi (data) {
    return baseRequest.baseRequest('api/userAddress/add', 'post', JSON.stringify(data))
}
// 修改地址/api/userAddress/update post
export function updateUserAddressApi (data) {
    return baseRequest.baseRequest('api/userAddress/update', 'post', JSON.stringify(data))
}
// 删除地址/api/userAddress/delete?addressId=xxx    delete 请求
// export function deleteUserAddressApi (data) {
//     return baseRequest.baseRequest('api/userAddress/delete', 'delete', data)
// }
export function deleteUserAddressApi(data) {
    return baseRequest.baseRequest(
        `api/userAddress/delete?addressId=${data.addressId}`,  // 将地址ID拼接到URL
        'delete'  // 保持DELETE方法
    )
}

// 获取用户信息  账户余额 支付页面
export function getWxUserInfoApi (data) {
    return baseRequest.baseRequest('api/miniProgram/wxUser', 'get', data)
}

// 更新修改用户信息 /api/miniProgram/updateUserInfo post
export function updateUserInfoApi (data) {
    return baseRequest.baseRequest('api/miniProgram/updateUserInfo', 'post', JSON.stringify(data))
}

// 个人中心 /api/miniProgram/my/page  什么也不传
export function getMyPageApi (data) {
    return baseRequest.baseRequest('api/miniProgram/my/page', 'get', data)
}

//我的优惠券
// export function getMyCouponApi (data) {
//     return baseRequest.baseRequest('api/miniProgram/my/coupon', 'get', data)
// }
// 我的积分 /api/miniProgram/my/points
export function getMyPointsApi (data) {
    return baseRequest.baseRequest('api/miniProgram/my/points', 'get', data)
}
// 我的服务 /api/miniProgram/my/service
export function getMyServiceApi (data) {
    return baseRequest.baseRequest('api/miniProgram/my/service', 'get', data)
}

// 我的钱包 /api/miniProgram/my/wallet
export function getMyWalletApi (data) {
    return baseRequest.baseRequest('api/miniProgram/my/wallet', 'get', data)
}


// 我的优惠券  /api/couponUser/getUserAllCoupon  get
export function getUserAllCouponApi (data) {
    return baseRequest.baseRequest('api/couponUser/getUserAllCoupon', 'get', data)
}


// 查询用户余额 /api/miniProgram/myWalletBalance get
export function getMyWalletBalanceApi (data) {
    return baseRequest.baseRequest('api/miniProgram/myWalletBalance', 'get', data)
}

// 查询用户余额 及余额明细 /api/miniProgram/myWalletBalanceDetail get
export function getMyWalletBalanceDetailApi (data) {
    return baseRequest.baseRequest('api/miniProgram/myWalletBalanceDetail', 'get', data)
}